import { MAP } from "../Types";
import { TILE } from "../enum";
import { Coord } from "./Coord";
import { GetLine } from "./GetLine";

/** 连接两个点的线的绘制方式 */
export function DrawLine(from: Coord, to: Coord, map: MAP) {
    const line = GetLine(from, to);
    line.forEach(({ tileX, tileY }) => {
        // 将路径的周围变成可以通过即可
        map.$mapAround(tileX, tileY, (_, x, y) => {
            if (tileX === x) map.set(x, y, TILE.Link);
        });
    });
}
